package com.thoughtworks.preuniversity.biblioteca;

/**
 * Created by padmavb on 6/19/14.
 */
public class Movie {

    private String name,director;
    private int year,rating;
    public Movie(String name,int year,String director,int rating){

        this.name=name;
        this.year=year;
        this.director=director;
        this.rating=rating;
    }


    public String getName() {
        return name;
    }

    public int getYear() {
        return year;
    }

    public String getDirector() {
        return director;
    }

    public int getRating() {
        return rating;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Movie movie = (Movie) o;

        if (rating != movie.rating) return false;
        if (year != movie.year) return false;
        if (!director.equals(movie.director)) return false;
        if (!name.equals(movie.name)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + director.hashCode();
        result = 31 * result + year;
        result = 31 * result + rating;
        return result;
    }
}
